home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / OTHER_LA / 1410B.ZIP / ST3_ORIG.ZIP / ST.C < prev    next >
C/C++ Source or Header  |  1989-04-01  |  2KB  |  85 lines

  1. /*
  2.     Little Smalltalk, version 3
  3.     Main Driver
  4.     written By Tim Budd, September 1988
  5.     Oregon State University
  6. */
  7. # include <stdio.h>
  8. # include "env.h"
  9. # include "memory.h"
  10. # include "names.h"
  11.  
  12. int initial = 0;    /* not making initial image */
  13.  
  14. extern int objectCount();
  15.  
  16. # ifdef NOARGC
  17. main()
  18. # endif
  19. # ifndef NOARGC
  20. main(argc, argv)
  21. int argc;
  22. char **argv;
  23. # endif
  24. {
  25. FILE *fp;
  26. object firstProcess;
  27. char *p, buffer[120];
  28.  
  29. initMemoryManager();
  30.  
  31. strcpy(buffer,"systemImage");
  32. p = buffer;
  33.  
  34. # ifdef STDWIN
  35. /* initialize the standard windows package */
  36. winit();
  37. wmenusetdeflocal(1);
  38.  
  39. if (! waskync("use default initial object image?", 1))
  40.     waskfile("image file name", buffer, 120, 0);
  41. # endif
  42.  
  43. # ifndef NOARGC
  44. if (argc != 1) p = argv[1];
  45. # endif
  46.  
  47. # ifdef BINREADWRITE
  48. fp = fopen(p, "rb");
  49. # endif
  50. # ifndef BINREADWRITE
  51. fp = fopen(p, "r");
  52. # endif
  53.  
  54. if (fp == NULL) {
  55.     sysError("cannot open image", p);
  56.     exit(1);
  57.     }
  58. imageRead(fp);
  59. initCommonSymbols();
  60.  
  61. firstProcess = globalSymbol("systemProcess");
  62. if (firstProcess == nilobj) {
  63.     sysError("no initial process","in image");
  64.     exit(1); return 1;
  65.     }
  66.  
  67. /* execute the main system process loop repeatedly */
  68. /*debugging = true;*/
  69.  
  70. # ifndef STDWIN
  71. /* not using windowing interface, safe to print out message */
  72. printf("Little Smalltalk, Version 3.04\n");
  73. printf("Written by Tim Budd, Oregon State University\n");
  74. # endif
  75.  
  76. while (execute(firstProcess, 15000)) ;
  77.  
  78. # ifdef STDWIN
  79. wdone();
  80. # endif
  81.  
  82. /* exit and return - belt and suspenders, but it keeps lint happy */
  83. exit(0); return 0;
  84. }
  85.